package com.google.android.exoplayer2.source;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.Format;
import java.util.Arrays;
import o.amm;

public final class TrackGroup implements Parcelable {
    public static final Creator<TrackGroup> CREATOR = new Creator<TrackGroup>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ˊ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ˊ(i);
        }

        public TrackGroup ˊ(Parcel parcel) {
            return new TrackGroup(parcel);
        }

        public TrackGroup[] ˊ(int i) {
            return new TrackGroup[i];
        }
    };
    private int ˊ;
    private final Format[] ˏ;
    public final int ॱ;

    public TrackGroup(Format... formatArr) {
        amm.ˏ(formatArr.length > 0);
        this.ˏ = formatArr;
        this.ॱ = formatArr.length;
    }

    TrackGroup(Parcel parcel) {
        this.ॱ = parcel.readInt();
        this.ˏ = new Format[this.ॱ];
        for (int i = 0; i < this.ॱ; i++) {
            this.ˏ[i] = (Format) parcel.readParcelable(Format.class.getClassLoader());
        }
    }

    public Format ˊ(int i) {
        return this.ˏ[i];
    }

    public int ˊ(Format format) {
        for (int i = 0; i < this.ˏ.length; i++) {
            if (format == this.ˏ[i]) {
                return i;
            }
        }
        return -1;
    }

    public int hashCode() {
        if (this.ˊ == 0) {
            this.ˊ = Arrays.hashCode(this.ˏ) + 527;
        }
        return this.ˊ;
    }

    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        TrackGroup trackGroup = (TrackGroup) obj;
        if (this.ॱ == trackGroup.ॱ && Arrays.equals(this.ˏ, trackGroup.ˏ)) {
            return true;
        }
        return false;
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.ॱ);
        for (int i2 = 0; i2 < this.ॱ; i2++) {
            parcel.writeParcelable(this.ˏ[i2], 0);
        }
    }
}
